/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 阿宾
 * Date: 2024-10-17
 * Time: 09:35
 */
public class MySeqListTest {
    public static void main(String[] args) {
        MySeqList mySeqList = new MySeqList();
        //1.数组尾部插入元素
        mySeqList.add(1);
        mySeqList.add(2);
        mySeqList.add(3);
        mySeqList.add(4);

        //2.指定下标位置插入元素
        mySeqList.add(0,8);
        mySeqList.add(5,10);
        mySeqList.display();
        mySeqList.add(7,43);

        //3.检查是否包含指定元素
        boolean ret = mySeqList.contains(7);
        System.out.println(ret);
        boolean ret1 = mySeqList.contains(10);
        System.out.println(ret1);

        //4.返回指定元素下标,此时顺序表元素：8 1 2 3 4 10
        int ret2 = mySeqList.indexOf(10);
        int ret3 = mySeqList.indexOf(1);
        int ret4 = mySeqList.indexOf(8);
        System.out.println(ret2 + " " + ret3 + " " + ret4);

        //5.返回指定位置元素
        System.out.println(mySeqList.get(0));
        System.out.println(mySeqList.get(3));
        System.out.println(mySeqList.get(5));

        //6.设置指定位置上的元素，此时顺序表元素：8 1 2 3 4 10
        mySeqList.set(0,100);
        mySeqList.set(5,200);
        mySeqList.set(3,300);
        mySeqList.display();

        //7.删除顺序表中的指定元素,此时顺序表元素：100 1 2 300 4 200
        mySeqList.remove(100);
        mySeqList.remove(200);
        mySeqList.remove(300);
        mySeqList.display();

        //8.获取顺序表长度
        System.out.println(mySeqList.size());
        //打印数组
        //mySeqList.display();
    }
}
